﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration.Conventions;

namespace ProjectThuCung.Models
{
    public class ThuCungDB : DbContext
    {
        public DbSet<HoaDon> HoaDons { get; set; }
        public DbSet<BaiViet> BaiViets { get; set; }
        public DbSet<BinhLuanBaiViet> BinhLuanBaiViets { get; set; }
        public DbSet<BinhLuanSanPham> BinhLuanSanPhams { get; set; }
        public DbSet<CTHoaDon> CTHoaDons { get; set; }
        public DbSet<LoaiSanPham> LoaiSanPhams { get; set; }
        public DbSet<PhanLoaiVatPham> PhanLoaiVatPhans { get; set; }
        public DbSet<SanPham> SanPhams { get; set; }
        public DbSet<ThongTinThem> ThongTinThems { get; set; }
        public DbSet<XuatXu> XuatXus { get; set; }
        public DbSet<UserProfile> UserProfiles { get; set; }
        public DbSet<Group> Groups { get; set; }
        public DbSet<GroupProfile> GroupProfiles { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
            //modelBuilder.Entity<SanPham>().HasOptional(p => p.LoaiSanPham).WithRequired(p => p.);
        }
    }
}